package com.contain.gateway.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * @Auther: tianchao
 * @Date: 2021/7/7 23:06
 * @Description:
 */
@Component
@Slf4j
public class TestFilter implements GlobalFilter, Ordered {

    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        log.info("filter 之前。。。。。。。。。。。。");
        Mono<Void> filter = chain.filter(exchange);
        log.info("filter 之后。。。。。。。。。。。。。");
        return filter;
    }

    @Override
    public int getOrder() {
        return -1;
    }
}
